Skip to content

Add per-page metadata (generateMetadata from query-index)#31

Merged
lamontacrook merged 1 commit into
mainfrom
page-metadata
Jul 6, 2026
Merged

Add per-page metadata (generateMetadata from query-index)#31
lamontacrook merged 1 commit into
mainfrom
page-metadata

Conversation

@lamontacrook

Copy link
Copy Markdown
Contributor

What

Adds generateMetadata to the [[...slug]] catch-all so each page renders its own <title>, description, and Open Graph tags instead of the static layout default (next-eds spike).

  • lib/eds/metadata.jsbuildMetadata(slug) looks the page up in the query-index feed and returns { title, description, openGraph: { title, description, images } }. Returns {} (→ layout defaults) when a page isn't indexed.
  • page.js — exports generateMetadata, reusing the same cached fetchQueryIndex() as generateStaticParams.

Metadata is authored in EDS via each page's Metadata block (Title / Description / Image), which helix-query.yaml indexes — so content authors control it, and the Worker surfaces it.

Verified

npm run build prerenders per-page titles from the feed:

  • /how-to-build-a-new-blockHow to Build a New Block
  • /Next.js on Edge Delivery Services (+ og:title)
  • non-content routes keep the fallback.

Lint clean.

Note: a page shows its metadata once it's published (so it's in query-index) and this is deployed. The Getting Started page has its Metadata block authored and will pick this up on publish.

🤖 Generated with Claude Code

The catch-all now exports generateMetadata, reading each page's title,
description, and og:image from the query-index feed (authored via the page's
Metadata block, indexed by helix-query.yaml). Previously every Worker-rendered
page used the static layout title ("next-eds spike"). Falls back to the layout
defaults when a page isn't indexed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Jul 6, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run all PSI checks
  • Re-run failed PSI checks
  • Re-sync branch
Commits

@lamontacrook
lamontacrook merged commit aac284a into main Jul 6, 2026
2 of 3 checks passed
@lamontacrook
lamontacrook deleted the page-metadata branch July 6, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant